<?php use_helper('Validation'); ?>

<h3>Gestion des galleries photos</h3>

<div id="sf_admin_container">

  <?php if ($sf_flash->has('success')): ?>
  <p class="success" style="margin-bottom: 16px;">
    <?php echo $sf_flash->get('success') ?>
  </p>
  <?php endif; ?>
  
  <?php echo form_tag('gallery/index') ?>
  
  <p>
    <label for="title">Ajouter une nouvelle gallerie</label>
    <?php echo input_tag('title'); ?>
    <?php echo submit_tag('Ajouter') ?>
  </p>
  
  </form>
  
  <p>
    <?php echo link_to('réorganiser l\'ordre des galleries publiés', 'gallery/galleryOrder') ?>
  </p>
  
  <div id="sf_admin_content">
  
  <?php if (!empty($galleries)): ?>
  <table cellspacing="0" class="sf_admin_list">
  <thead>
  <tr>
    <th>
      Nom de la gallerie photo
    </th>
    <th>
      Etat de publication
    </th>
    <th>
      Nombre de photos
    </th>
    <th colspan="3">
      Actions
    </th>
  </tr>
  </thead>
  <tbody>
    <?php foreach ($galleries as $gallerie): ?>
    <tr>
      <td>
        <?php echo $gallerie->getTitle() ?>
      </td>
      <td>
        <?php if ($gallerie->getIsPublished() == true): ?>
        <?php echo link_to(image_tag('/admin/sf/sf_admin/images/tick.png', 'style="border: none" title="dépublier"'), 'gallery/togglePublish?publish=false&gallery_id='.$gallerie->getId(), 'style="border: none;" title="dépublier"') ?>
        <?php else: ?>
        <?php echo link_to(image_tag('/admin/sf/sf_admin/images/cancel.png', 'style="border: none" title="Publier"'), 'gallery/togglePublish?publish=true&gallery_id='.$gallerie->getId(), 'style="border: none;" title="publier"') ?>
        <?php endif; ?>
      </td>
      <td>
        <?php echo $gallerie->countPictures() ?>
      </td>
      <td>
        <?php echo link_to('gestion des photos associés', 'gallery/view?gallery_id='.$gallerie->getId()) ?>
        <?php echo link_to('réorganiser les photos', 'gallery/organize?gallery_id='.$gallerie->getId()) ?>
        <?php echo link_to('supprimer', 'gallery/delete?gallery_id='.$gallerie->getId(), 'confirm="Etes vous sûr de vouloir supprimer cette gallerie et toutes les photos associées ?"') ?>
      </td>
    </tr>
    <?php endforeach; ?>
  </tbody>
  </table>
  <?php endif; ?>
  
  </div>

</div>


